package com.xue.Order.Service.Imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xue.Common.Service.CommonService;
import com.xue.Common.Service.Imp.CommonServiceImp;
import com.xue.Order.Service.OrderService;

/**
*class explain
*/
@Service("orderService")
public class OrderServiceImp  extends CommonServiceImp implements OrderService {
	@Override
	public int query(String where) {
		String wheres ="where address like '%"+where+"%' or carno like '%"+where+"%' or phoneno like '%"+where+"%' or explain like '%"+where+"%'";
		String sql ="SELECT count(*)  FROM orders T "+wheres;		
		return Integer.parseInt(super.createSql(sql).get(0).toString());
	}

	@Override
	public List<?> listpage(String pageno, String pagesize, String search) {
		String where ="where address like '%"+search+"%' or carno like '%"+search+"%' or phoneno like '%"+search+"%' or explain like '%"+search+"%'";
		String sql="SELECT * FROM ( SELECT ROWNUM AS LIMITNUM,T.*  FROM orders T "+where+" ) WHERE LIMITNUM BETWEEN ("+pageno+"-1)*"+pagesize+" AND "+pageno+"*"+pagesize;	
		return super.orderSql(sql);
	}
	
	@Override
	public boolean saveorupd(Object obj){
		return commonDao.saveorupd(obj);
		
	}

	@Override
	public Object queryforid(String orderid) {
		// TODO Auto-generated method stub
		return commonDao.queryforid(orderid);	
	}
	
	@Override
	public boolean delete(Object obj) {
		// TODO Auto-generated method stub
		return commonDao.delete(obj);
	}
}
